<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="jquery-1.12.4.min.js"></script>
    <script type="text/javascript">
        function req(){
            var xhr = new XMLHttpRequest();
            xhr.open("post","${pageContext.request.contextPath}/req/test01?"+new Date().getTime());
            xhr.setRequestHeader("content-type","application/json");//设置请求头
            xhr.send('{"age":18,"name":"shine","address":"beijing"}');//传递json串
        }
    </script>
</head>
<body>
<input type="button" onclick="req()" value="点击1"/>
<input type="button" onclick="resp()" value="点击2"/>

</body>
</html>